#include "cJSON.h"
#include "log.h"
#include <stdlib.h>

int main(int argc, char const *argv[])
{
    log_set_level(LOG_DEBUG);
    cJSON *json = cJSON_CreateObject();
    char *name = "lbs";
    int age = 22;
    cJSON_AddStringToObject(json, "name", name);
    cJSON_AddNumberToObject(json, "age", age);
    char *st = cJSON_PrintUnformatted(json);
    log_debug("json: %s", st);
    cJSON *json2 = cJSON_Parse(st);
    char *name2 = cJSON_GetObjectItem(json2, "name")->valuestring;
    int age2 = cJSON_GetObjectItem(json2, "age")->valueint;
    log_debug("name: %s, age: %d", name2, age2);
    cJSON_Delete(json);
    cJSON_Delete(json2);
    free(st);
    return 0;
}

